#include<REGX52.H>
#include "delayms.h"
#include "lcd1602.h"
#include "keyboard.h"

unsigned char keyCode;//保存按键编码
unsigned int password;//保存用户输入的密码
unsigned char count;//保存输入密码的位数
//段选位选只能显示一个
//循环，同时显示
void main(){
	LCD_Init();
	LCD_ShowString(1,1,"Password:");
	
	
	while(1)
	{	
		keyCode=GetKeyCode();
		if(keyCode)
		{	//数字按键
			if(keyCode<=10&&count<4)
			{
				password=password*10+keyCode%10;
			}
			//功能按键
			if(keyCode==11){}
			if(keyCode==12)//取消按键功能按键
			{
				count=0;
				password=0;
				LCD_ShowNum();
			}
		}
	}   

}
